//
//  CustomAnnotationView.m
//  flutter_plugin_gdmap
//
//  Created by Xiaoka on 2021/9/16.
//

#import "CustomAnnotationView.h"
#import "CustomPointAnnotation.h"

@interface CustomAnnotationView ()

@property (nonatomic, strong) UILabel *sortLabel;
@property (nonatomic, strong) UIImageView *imgView;

@end

@implementation CustomAnnotationView

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{    
    [super setSelected:selected animated:animated];
}

- (id)initWithAnnotation:(id<MAAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
    
    if (self)
    {
        self.bounds = CGRectMake(0.f, 0.f, 36, 40);
        self.backgroundColor = [UIColor clearColor];
        
        // 添加图片
        self.imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 36, 40)];
        self.imgView.image=[UIImage imageNamed:@"imgSort"];
        [self addSubview:self.imgView];
        
        // 添加排序文本
        self.sortLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 36, 40)];
        self.sortLabel.textAlignment = NSTextAlignmentCenter;
        self.sortLabel.font = [UIFont boldSystemFontOfSize:14];
        self.sortLabel.textColor = [UIColor whiteColor];
        [self addSubview:self.sortLabel];
    }
    
    return self;
}

- (void)setNumSort:(NSString *)numSort
{
    self.sortLabel.text = numSort;
}

@end
